package com.comum.javahomework420242025.repository;

import com.comum.javahomework420242025.pojo.AllFile;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface AllFileRepository extends JpaRepository<AllFile, Long> {
    @Query(value = "select filename from allfile where elseid=:elseid and type=:type",nativeQuery = true)
    List<String> findfilenames(String elseid, String type);

    @Modifying
    @Transactional
    @Query(value = "delete from allfile where elseid=:id and type=:type",nativeQuery = true)
    void deleteByElseIdAndType(String id, String type);
}